Challenges Solved
Beginner
- Secure Shell
- Simpler RSA
Forensics
- Forgot Password
- Black meets Wukong
Beginner
Secure Shell
Navigating to the webpage
I got this, now from the looks of things here I knew immediately that it has something to do with command injection
Running the ls
command, I got this
There’s an index.php
file
But then this command cd ../../../ && ls -la
gets flagged
This didn’t bother me actually because I saw something similar when I played picoctf 2023
, you can read the writeup here
This should work actually
Now, instead of using the cd ../../../ && ls -la
command, I did this instead echo "$(cd ../../../ && ls -la)"
All that’s left now is to read the flag, this command should do it echo "$(cd ../../../ && cat flag)"
It is evident from the above screenshot that the flag
file most likely contains the flag but then it has read-only access, while the readflag
is an executable that likely allows me to read the flag
file.
All I did to get the flag was to run readflag
executable using the command echo "$(cd ../../../ && ./readflag)"
Got the flag
FLAG:-wwf{th3_os_c0mm4nd_1nj3ct10n!}
Simpler RSA
Checking the content of the txt file, I saw this
┌──(bl4ck4non💀bl4ck4non-sec)-[~/…/CTF/wwctf/beginners/simpler_rsa]
└─$ cat out.txt
p=20322136122026329892580404875086132520732558134579258531781672192065024437324055172065343417524169304918928056147680414370351055409439818026607876517460045945556933456319117456860928521423787112252544266864178773974904640732880445449138842965327995838722222110164109025916914430044528254715080648900354468118393295346137198518513075775514617222780524163798065365970392865107270392212968677531885628998155305428785133820145555740608026626724539584106018453003156159305252013173659975815845286802275956807162426425721298560633326719023970391963404981189820163950120529861779878077006530640930032570206978446007206971761
q=19097560527100693557502945814016176943507375936656621847599300620729196257594977906326233653252987169303598004653720974045696589437233399711658994040877123702369987961301047714594623670674571987772814959679153558360152976652255742578324469478560556855210734037861198243000935281050776548747455717266013266531885744852759548255091579407464355390341944708706006878618904548103612995804547530724085856234186750409404880456083750984829553552127853848824218180459231650990529456828407224866655873224370892839628814748212142246752082561042142636866939231370987974125358875253454199574864895153300338298982667319003886687691
c=4281681357519343869235268029657832985104802601857889851833662824770073601279722389949102805423012693423900316266993146428480448851806951090530135683459342224839031144425810971344588481297094697047852347659595441639804230546879345999083627138617034295731725402645279785129174304818023129638779656619113578465655082808462489379872294929944719545647280271454196700396004152529288987570497804498041888697213294509916951489315431831556860863264254674452235360890586742441263188663158067860877772336480637257856658858967478284817730555629113613134338975168062044831796369552664256963808360408525644200922627703094455580032
The file contains 3 large integers p, q and c
.
p and
are large prime numbers used to calaculate the modulusn
wheren = p * q
c
represents the ciphertext
So the task basically is to decrypt the ciphertext.
Upon solving this the way I know how, I got some gibberish stuff
Apparently, I wasn’t the only one😂
I actually noticed my mistake after solving this chall, when I solved initally I calculated the value for n
, also I assumed e
to be 65537
, all these wasn’t needed actually.
Now, determining e
is unnecessary, as d
can be directly computed using the private key. Specifically, d
is obtained as the modular multiplicative inverse of p modulo q−1 (mod q - 1)
.
To solve this, I used this python script
from Crypto.Util.number import inverse, long_to_bytes
p=20322136122026329892580404875086132520732558134579258531781672192065024437324055172065343417524169304918928056147680414370351055409439818026607876517460045945556933456319117456860928521423787112252544266864178773974904640732880445449138842965327995838722222110164109025916914430044528254715080648900354468118393295346137198518513075775514617222780524163798065365970392865107270392212968677531885628998155305428785133820145555740608026626724539584106018453003156159305252013173659975815845286802275956807162426425721298560633326719023970391963404981189820163950120529861779878077006530640930032570206978446007206971761
q=19097560527100693557502945814016176943507375936656621847599300620729196257594977906326233653252987169303598004653720974045696589437233399711658994040877123702369987961301047714594623670674571987772814959679153558360152976652255742578324469478560556855210734037861198243000935281050776548747455717266013266531885744852759548255091579407464355390341944708706006878618904548103612995804547530724085856234186750409404880456083750984829553552127853848824218180459231650990529456828407224866655873224370892839628814748212142246752082561042142636866939231370987974125358875253454199574864895153300338298982667319003886687691
c=4281681357519343869235268029657832985104802601857889851833662824770073601279722389949102805423012693423900316266993146428480448851806951090530135683459342224839031144425810971344588481297094697047852347659595441639804230546879345999083627138617034295731725402645279785129174304818023129638779656619113578465655082808462489379872294929944719545647280271454196700396004152529288987570497804498041888697213294509916951489315431831556860863264254674452235360890586742441263188663158067860877772336480637257856658858967478284817730555629113613134338975168062044831796369552664256963808360408525644200922627703094455580032
d = inverse(p, q-1)
pt = long_to_bytes(pow(c, d, q))
print(pt)
The script decrypts a ciphertext c using modular arithmetic. It calculates d
, the modular inverse of p modulo q−1
, then computes c d mod q
to derive the plaintext. The plaintext is converted to a readable byte string using long_to_bytes
.
Running the script,
┌──(bl4ck4non💀bl4ck4non-sec)-[~/…/CTF/wwctf/beginners/simpler_rsa]
└─$ python solve.py
b'wwf{ju57_u53_l1br4r135}'
I got the flag
FLAG:-wwf{ju57_u53_l1br4r135}
Forensics
┌──(bl4ck4non💀bl4ck4non-sec)-[~/…/CTF/wwctf/forensics/black_meets_wukong]
└─$ file Evidence.ad1
Evidence.ad1: data
The writeup for this will be added later
Later means either when I get wine fixed or when I get a windows box to run the ftkimager on.
Bruhh, I had to wait till midnight to download the 1.8gb file, only to find out that I can only solve it with a windows box just because I can’t get wine to work💀
Till Next Time :xD